/***************************************************************************
 *   Copyright (C) 2008 by Goliash   *
 *   goliash@goliash.net   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
 #ifndef MEDIUM_H
 #define MEDIUM_H

 #include <QObject>
 #include <QString>
 #include <QDateTime>
 #include <QtGui>

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>

#include <sys/ioctl.h>
#include <linux/fs.h>
//#include "scan_dialog.h"
#include "file.h"
#include "preferences.h"

// create medium, scan and add information to db
class Medium : public QObject
{
	Q_OBJECT

public:
	Medium();
	~Medium();
	int scanISO9660();
	int fs_read_data ( char * fs, int seek, int len, char * data);
	char *findValue(int sector, int len);
	QString getName();
	QString getOriginal_name();
	QString getCreation_time();
	QString getCreateApplication();
	QString getPath();
	QString getDevice();
	QString getFilesystem();
	QString getMountPointOfDevice(QString device);
	double getSize();
	void findOriginal_name();
	void findCreation_time();
	void findCreate_application();	
	void findSize();
	//void scanMedium(ScanDialog *scan_dialog);
	bool isMounted();
	QList<File *> children;
	QString childrenToString();
	void setExploringTime(int time);
	int getExploringTime();
	void setId(int id);
	int getId();
	void setName(QString name);
	bool mount();

signals:
	void stateChanged(int state);

private:
	int id;
	unsigned long size;
	int state;
	bool mounted;
	QString device;
	QString create_application;
	//QDateTime creation_time;
	QString creation_time;
	QString filesystem;
	QString original_name;
	QString name;
	QString mount_point;

	int exploring_time;
	//comment
	// size in db
	// added to db
};

#endif
